﻿/* 
This file is part of Ingo Karstein's Excel Export project

**Do not remove this comment**

Please see the project homepage at CodePlex:
  http://spexcelexport.codeplex.com/

Please see my blog:
  http://ikarstein.wordpress.com

Licence: GPLv2
    Ingo Karstein's SharePoint 2010 Custom Ribbon Demo
    Copyright (C) 2011  Ingo Karstein, ikarstein@hotmail.com

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace ik.SharePoint2010.ExcelExport.Code
{
    /// <summary>
    /// Provides a standard way to access the namespace prefixes for the Open XML document namespaces.
    /// </summary>
    public static class Prefixes
    {
        // Standard Open XML Namespace prefixes
        public const string Relationships = "r";
        public const string MarkupCompatibility = "mc";
        public const string SpreadsheetML = "";
    }

    /// <summary>
    /// Provides a standard way to access the namespace URIs for the Open XML document namespaces.
    /// Also provides a preconstructed namespace manager for the namespaces and prefixes.
    /// </summary>
    public static class Namespaces
    {
        // Standard Open XML Namespace URIs
        public const string Relationships = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
        public const string MarkupCompatibility = "http://schemas.openxmlformats.org/markup-compatibility/2006";
        public const string SpreadsheetML = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";

        #region Namespace Manager Methods
        private static XmlNamespaceManager m_namespaceManager = new XmlNamespaceManager(new NameTable());

        /// <summary>
        /// Initializes the namespace manager with all of the Open XML document namespaces.
        /// </summary>
        static Namespaces()
        {
            m_namespaceManager.AddNamespace(Prefixes.Relationships, Namespaces.Relationships);
            m_namespaceManager.AddNamespace(Prefixes.MarkupCompatibility, Namespaces.MarkupCompatibility);
            m_namespaceManager.AddNamespace(Prefixes.SpreadsheetML,  Namespaces.SpreadsheetML);
        }

        /// <summary>
        /// Returns the static namespace manager 
        /// </summary>
        public static XmlNamespaceManager NamespaceManager
        {
            get { return m_namespaceManager; }
        }
        #endregion
    }
}
